<form method="POST" class="remote-form">
    <b>Sponsorship pending</b>:<br />
    {{ csrf_input }}
    <input type="hidden" name="{{ remote_type }}" value="{{ remote_id }}" />
    <select name="sponsorship_pending">
        <option value="true" {% if sponsorship_data.sponsorship_pending %}selected{% endif %}>Yes</option>
        <option value="false" {% if not sponsorship_data.sponsorship_pending %}selected{% endif %}>No</option>
    </select>
    <button type="submit" class="btn btn-default support-submit-button">Update</button>
</form>

{% if sponsorship_data.sponsorship_pending %}
<form method="POST" class="">
    {{ csrf_input }}
    <input type="hidden" name="{{ remote_type }}" value="{{ remote_id }}" />
    <input type="hidden" name="approve_sponsorship" value="true" />
    <button class="btn btn-default sea-green small approve-sponsorship-button">
        Approve full sponsorship
    </button>
</form>
{% endif %}

<form method="POST" class="remote-form">
    <b>Discount percentage</b>:<br />
    <i>Updates will change pre-existing plans and scheduled upgrades.</i><br />
    <i>Any prorated licenses for the current billing cycle will be billed at the updated discounted rate.</i><br />
    {{ csrf_input }}
    <input type="hidden" name="{{ remote_type }}" value="{{ remote_id }}" />
    {% if has_fixed_price %}
    <input type="number" name="discount" value="{{ format_discount(sponsorship_data.default_discount) }}" step="0.01" min="0" max="99.99" disabled />
    <button type="submit" class="btn btn-default support-submit-button" disabled>Update</button>
    {% else %}
    <input type="number" name="discount" value="{{ format_discount(sponsorship_data.default_discount) }}" step="0.01" min="0" max="99.99" required />
    <button type="submit" class="btn btn-default support-submit-button">Update</button>
    {% endif %}
</form>

{% if not has_fixed_price and (sponsorship_data.default_discount or sponsorship_data.minimum_licenses) %}
<form method="POST" class="remote-form">
    <b>Minimum licenses</b>:<br />
    {{ csrf_input }}
    <input type="hidden" name="{{ remote_type }}" value="{{ remote_id }}" />
    <input type="number" name="minimum_licenses" value="{{ sponsorship_data.minimum_licenses }}" required />
    <button type="submit" class="btn btn-default support-submit-button">Update</button>
</form>
{% endif %}

<form method="POST" class="remote-form">
    <b>Required plan tier for discounts and fixed prices</b>:<br />
    <i>Updates will not change any pre-existing plans or scheduled upgrades.</i><br />
    {{ csrf_input }}
    <input type="hidden" name="{{ remote_type }}" value="{{ remote_id }}" />
    <select name="required_plan_tier">
        {% for plan_tier in REMOTE_PLAN_TIERS %}
            {% if sponsorship_data.required_plan_tier == plan_tier.value %}
                <option value="{{ plan_tier.value }}" selected>{{ plan_tier.name }}</option>
            {% else %}
                <option value="{{ plan_tier.value }}">{{ plan_tier.name }}</option>
            {% endif %}
        {% endfor %}
    </select>
    <button type="submit" class="btn btn-default support-submit-button">Update</button>
</form>

{% if sponsorship_data.sponsorship_pending %}
<div class="">
    <h4>Sponsorship request information:</h4>
    {% if sponsorship_data.latest_sponsorship_request %}
    <ul>
        <li><b>Organization type</b>: {{ sponsorship_data.latest_sponsorship_request.org_type }}</li>
        <li><b>Organization website</b>: {{ sponsorship_data.latest_sponsorship_request.org_website }}</li>
        <li><b>Organization description</b>: {{ sponsorship_data.latest_sponsorship_request.org_description }}</li>
        <li><b>Estimated total users</b>: {{ sponsorship_data.latest_sponsorship_request.total_users }}</li>
        <li><b>Paid staff</b>: {{ sponsorship_data.latest_sponsorship_request.paid_users }}</li>
        <li><b>Description of paid staff</b>: {{ sponsorship_data.latest_sponsorship_request.paid_users_description }}</li>
        <li><b>Requested plan</b>: {{ sponsorship_data.latest_sponsorship_request.requested_plan }}</li>
    </ul>
    {% else %}
    <b>No sponsorship requests have been submitted.</b><br /><br />
    {% endif %}
</div>
{% endif %}
